import { watch } from 'vue'
import { storeToRefs } from 'pinia'
import useTheme from '@/store/theme/index.js'
const useThemeStore = useTheme()
const { currentTheme } = storeToRefs(useThemeStore) // 假设 theme 是整个主题对象
const html =document.querySelector('html')
export default () => {
    watch(
        () => currentTheme, // 监听 theme.theme 的变化
        
        (newTheme) => {
            const themeClassMap = {
                light: 'light',
                dark: 'dark',
                auto: '' // 设置 auto 对应的 className 或保持为空
            }
            html.className = themeClassMap[currentTheme.value.theme] || ''
        },
        { immediate: true ,deep: true}
    )
}
